[PWGCF] Added option to reject the inside or the outside of the detector ring of FT0#14190
[PWGCF] Added option to reject the inside or the outside of the detector ring of FT0#14190MartijnLaarhoven wants to merge 1 commit intoAliceO2Group:masterfrom
Conversation
Added option to reject the inside or the outside of the detector ring of FT0
|
O2 linter results: ❌ 2 errors, |
There was a problem hiding this comment.
Pull request overview
This PR adds configuration options to selectively reject signals from inside or outside rings of the FT0 detector in the long-range dihadron correlation analysis. The implementation introduces two boolean flags that control whether to zero out amplitudes from specific channel ID ranges.
Key changes:
- Added two new configurables:
cfgRejectOutsideDetectorsandcfgRejectInsideDetectorsto control ring rejection - Implemented channel rejection logic in the
getChannel()function for both FT0A and FT0C detector sections - Rejection is performed by setting amplitude to 0 for channels in specific ID ranges
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142)))) | ||
| ampl = 0.; |
There was a problem hiding this comment.
There's no validation to prevent both cfgRejectInsideDetectors and cfgRejectOutsideDetectors from being enabled simultaneously. If both are true, this would reject all channels, which may not be the intended behavior. Consider adding mutual exclusivity validation or documenting the expected behavior when both are enabled.
| O2_DEFINE_CONFIGURABLE(cfgUseEventWeights, bool, false, "Use event weights for mixed event") | ||
| O2_DEFINE_CONFIGURABLE(cfgDrawEtaPhiDis, bool, false, "draw eta-phi distribution for detectors in used") | ||
| O2_DEFINE_CONFIGURABLE(cfgRejectOutsideDetectors, bool, false, "Rejection of outside ring events of the FT0 detector") | ||
| O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of inside ring events of the FT0 detector") |
There was a problem hiding this comment.
The description says "Rejection of inside ring events of the FT0 detector" but the implementation rejects channels (by setting amplitude to 0), not events. The description should clarify that this rejects signals from specific channels/rings rather than entire events.
| O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of inside ring events of the FT0 detector") | |
| O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of signals from inside ring channels of the FT0 detector") |
| O2_DEFINE_CONFIGURABLE(cfgRejectOutsideDetectors, bool, false, "Rejection of outside ring events of the FT0 detector") | ||
| O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of inside ring events of the FT0 detector") |
There was a problem hiding this comment.
The configurable name "cfgRejectOutsideDetectors" is ambiguous and could be misunderstood as rejecting multiple detectors. Consider renaming to "cfgRejectFT0OutsideRing" to be more specific and consistent with the description mentioning "FT0 detector".
| O2_DEFINE_CONFIGURABLE(cfgRejectOutsideDetectors, bool, false, "Rejection of outside ring events of the FT0 detector") | |
| O2_DEFINE_CONFIGURABLE(cfgRejectInsideDetectors, bool, false, "Rejection of inside ring events of the FT0 detector") | |
| O2_DEFINE_CONFIGURABLE(cfgRejectFT0OutsideRing, bool, false, "Reject events in the outside ring of the FT0 detector") | |
| O2_DEFINE_CONFIGURABLE(cfgRejectFT0InsideRing, bool, false, "Reject events in the inside ring of the FT0 detector") |
| id = id + Ft0IndexA; | ||
| ampl = ft0.amplitudeC()[iCh]; | ||
| if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142)))) | ||
| ampl = 0.; |
There was a problem hiding this comment.
The rejection logic appears to have a bug for FT0C channels. After adding Ft0IndexA (96) to the channel ID on line 642, the id range becomes 96-207. However, the rejection ranges include (0-30) which would never match FT0C channels, and (31-96) which would only match id=96. This suggests the rejection logic was designed for FT0A channel IDs (0-95) but is being incorrectly applied to FT0C after the offset is added. The rejection logic should be applied before adding the offset, or the ranges should be adjusted to account for the offset.
| id = id + Ft0IndexA; | |
| ampl = ft0.amplitudeC()[iCh]; | |
| if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142)))) | |
| ampl = 0.; | |
| ampl = ft0.amplitudeC()[iCh]; | |
| // Apply rejection logic to raw FT0C channel ID (before offset) | |
| if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142)))) | |
| ampl = 0.; | |
| id = id + Ft0IndexA; |
| if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142)))) | ||
| ampl = 0.; |
There was a problem hiding this comment.
This rejection logic is duplicated in both FT0C (lines 644-645) and FT0A (lines 652-653) sections. The identical conditional expression should be extracted into a helper function or applied before the if-else branch to improve code maintainability and reduce duplication.
| if ((cfgRejectInsideDetectors && ((id >= 31 && id <= 96) || (id >= 143 && id <= 208))) || (cfgRejectOutsideDetectors && ((id >= 0 && id <= 30) || (id >= 97 && id <= 142)))) | ||
| ampl = 0.; |
There was a problem hiding this comment.
The complex conditional expression with multiple OR and AND operators is difficult to read and verify. Consider breaking this into intermediate boolean variables with descriptive names (e.g., isInsideRing, isOutsideRing) or extracting it into a separate helper function to improve code clarity.
Added option to reject the inside or the outside of the detector ring of FT0